#include "gofgame/dungeonkeeper/game/unit/DarkElf.h"

using namespace gofgame::dungeonkeeper::game::unit;

DarkElf::DarkElf(){
	id = 102;
}

DarkElf::~DarkElf(){
}

bool DarkElf::init(){
	bool pRet = false;
	do 
	{
		unitType = UnitType::createById(this->id);
		texture = CCSprite::create(unitType.imageName);
		this->addChild(texture);
		updateState();
		Unit::init();
		pRet = true;
	} while (0);
	return pRet;
}

DarkElf * DarkElf::createByLevel(int lv){
	DarkElf *darkElf = new DarkElf();
	if(darkElf){
		darkElf->lv = lv;
		if( darkElf->init()){
			return darkElf;
		} else {
			return nullptr;
		}
	} else{
		return nullptr;
	}
}

void DarkElf::initData(){
	this->origHp = lv * 20 + unitType.getBaseHP();
	this->currentHp = origHp;
	this->atk = lv * 5 + unitType.getBaseAtk();
	this->def = lv * 5 + unitType.getBaseDef();
	this->speed = unitType.getBaseSpeed();
	this->attkSpeed = unitType.getBaseAttackSpeed();
	this->range = unitType.getBaseRange();
}


void DarkElf::doAI(){

}
